<?php
/**
 * Модель group
 * 
 * Класс модели
 * @author Anton Zavidov
 * @package myLiveShop
 */

/**
 * Модель group
 *
 */
class ModelGroup extends Model {
	
	const TABLE				= 'group';
	const F_GROUP_ID  	= 'group_id';
	const F_PARENT_ID  	= 'parent_id';
	const F_TITLE  	= 'title';
	const F_RIGHTS  	= 'rights';
			
	public function __construct($className=null){
		parent::__construct(__CLASS__);
		$this->name='group';
		$this->id_field=array(self::F_GROUP_ID);
		$this->fields=array(
		self::TABLE.DOT.self::F_GROUP_ID=> new Field($this,self::F_GROUP_ID,self::TABLE,array(
				'important'=>true,
				'auto'=>true,
				'lenght'=>2)),
		self::TABLE.DOT.self::F_PARENT_ID=> new Field($this,self::F_PARENT_ID,self::TABLE,array(
				'important'=>true,
				'lenght'=>2,
				'join_table'=>'group')),
		self::TABLE.DOT.self::F_TITLE=> new Field($this,self::F_TITLE,self::TABLE,array(
				'lenght'=>30,
				'type'=>Field::TYPE_STRING)),
		self::TABLE.DOT.self::F_RIGHTS=> new Field($this,self::F_RIGHTS,self::TABLE,array(
				'type'=>Field::TYPE_TEXT))		);
	}
}
